package com.github.gdxmap.layer.vector;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.github.gdxmap.geometry.Point;

import java.util.List;

/**
 * 折线
 * Created by free on 2016/12/7 0007.
 */
public class Polyline extends com.badlogic.gdx.math.Polyline implements VectorNode {

    private Color color=Color.RED;
    private int width=1;

    public Polyline(float[] vec){
        setVertices(vec);
    }

    public Polyline(List<Point> points){
        setPoints(points);
    }

    public void setPoints(List<Point> points) {
        float[] localVertices = new float[points.size() * 2];

        for (int i = 0; i < localVertices.length; i = i + 2) {
            Point point = points.get(i / 2);

            localVertices[i] = point.x;
            localVertices[i + 1] = point.y;
        }

        setVertices(localVertices);
    }

    @Override
    public void renderFill(PolygonSpriteBatch polygonSpriteBatch) {

    }
}
